import 'package:flutter/material.dart';

import '../Form.dart';

class CategoryPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => CategoryPageState();
}

class CategoryPageState extends State {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 8,
      child: Scaffold(
        appBar: AppBar(
          title: TabBar(isScrollable: true, tabs: [
            Tab(text: '111'),
            Tab(text: '222'),
            Tab(text: '333'),
            Tab(text: '444'),
            Tab(text: '555'),
            Tab(text: '666'),
            Tab(text: '777'),
            Tab(text: '888'),
          ]),
        ),
        body: TabBarView(
          children: [
            ListView(
              children: [
                SizedBox(height: 50),
                RaisedButton(
                  child: Text('跳转到表单页'),
                  onPressed: () {
                    Navigator.of(context).push(
                      MaterialPageRoute(
                          builder: (context) => FormPage(title: '跳转传的值')),
                    );
                  },
                ),
                SizedBox(height: 50),
                RaisedButton(
                  child: Text('第二种跳转到表单'),
                  onPressed: () {
                    Navigator.pushNamed(context, '/form',
                        arguments: {"id": 111111111});
                  },
                )
              ],
            ),
            Text('222'),
            Text('333'),
            Text('444'),
            Text('444'),
            Text('444'),
            Text('444'),
            Text('444'),
          ],
        ),
      ),
    );
  }
}
